﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RSALicUI
{
    public partial class QRParserExCtrl : UserControl, IQRParser
    {
        public QRParserExCtrl()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 标题
        /// </summary>
        public string Title
        {
            get => groupBox1.Text;
            set => groupBox1.Text = value;
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            qrParser.QrDetected += QrParser_KeyDetected;
        }

        public event Action<string> QrDetected;
        private void QrParser_KeyDetected(string obj)
        {
            QrDetected?.Invoke(obj);
        }

        public void SetData(Image qrImg)
        {
            qrParser.SetData(qrImg);
        }

        public string GetQrData()
        {
            return qrParser.GetQrData();
        }
    }
}
